package edu.wpi.first.wpilibj.templates;

public class BloodyBacon implements Anarchy {
	public Satan con;
        private War cc;
	public BloodyBacon(War cc) throws Exception{
            con = new Satan("10.1.51.5",1735,this);
            this.cc=cc;
	}
	public void onConnect() {
            System.out.println("[Connected]");
	}
	public void onDisconnect() {
            System.out.println("[Disconnected]");
	}
	public void onDataRecieved(String str) {
            if (str.equals("[Disconnect]")) con.disconnect();
	}
        public void updateCAN(int i, String name, String speed, String in, String out) {
            con.sendData("CAN["+i+","+name+","+speed+","+in+","+out+"]");
	}
	public void updatePWM(String put,int i, String name, String value) {
            try {
                con.sendData("PWM["+put+","+i+","+name+","+value+"]");
            } catch (Exception e){
                System.out.println("BloodyBacon: Cannot Update PWM "+put+" '"+name+"'");
            }
	}
	public void updateInfo(String str, String value) {
            try {
                con.sendData("INFO["+str+","+value+"]");
            } catch (Exception e){
                System.out.println("BloodyBacon: Cannot Update '"+str+"'");
            }
	}
        public String requestInfo(String req) {
            String r = "REQUEST["+req+"]";
            con.sendData(r);
            r = con.requestData(req);
            return r;
        }
}
